<!DOCTYPE html>
<html lang="en">
<head>
    <title>文章分类</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="${base}/res/manage/css/common.css">
    <link href="${base}/res/manage/css/ec.css" rel="stylesheet">
    <link href="${base}/res/manage/css/list.css" rel="stylesheet">
    <script type="text/javascript" src="${base}/res/plugin/jquery/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="${base}/res/plugin/validator/jquery.validate.min.js"></script>
    <script type="text/javascript" src="${base}/res/admin/js/common.js"></script>
    [#include "/admin/include/plupload.ftl" /]
    <script type="text/javascript">
        $(document).ready(function () {

            //图片上传
            var up = extPlupload("${base}", {});

            //表单验证，数据提交
            $("#inputForm").validate({
                rules: {
                    name: {
                        required: true,
                        maxlength: "50"
                    },
                    num: {
                        required: true,
                        digits: true,
                        maxlength: "4"
                    },
                    orders: {
                        required: true,
                        digits: true
                    },
                    isEnabled: {
                        required: true,
                    },
                    remark: {
                        maxlength: 128
                    }
                },
                messages: {
                    name: {
                        required: "必填项",
                        maxlength: "最长50个字符"
                    },
                    num: {
                        required: "必填项",
                        digits: "必须为数字",
                        maxlength: "最长4个字符"
                    },
                    orders: {
                        required: "必填项",
                        digits: "必须为数字"
                    },
                    isEnabled: {
                        required: "必选项"
                    },
                    remark: {
                        maxlength: "最长128个字符"
                    }
                },
                submitHandler: function (form) {
                    //表单提交
                    form.submit();

                }
            });
        });
    </script>
</head>
<body>
[#--主体--]
<div class="tab set">
    <h3><a href="list.jhtml"> 文章分类管理</a><a href="add.jhtml">> 添加文章分类</a></h3>
    <div class="tablist message set">
        <form id="inputForm" name="inputForm" action="save.jhtml" method="post">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td><label>栏目名称<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" id="name" name="name" placeholder="服务名称">
                    </td>

                    <td><label>父级节点</label></td>
                    <td>
                        <select id="parentId" name="parentId">
                            <option value="">请选择</option>
                        [#list articleTypes as articleType]
                            <option value="${articleType.id}">
                                [#if articleType.grade != 0]
                                    [#list 1..articleType.grade as i]
                                        &nbsp;&nbsp;
                                    [/#list]
                                [/#if]
                                ${articleType.name}
                            </option>
                        [/#list]
                        </select>
                        <a href="javascript:;" class="arrows">∨</a>
                    </td>
                </tr>
                <tr>
                    <td><label>列表页模版</label></td>
                    <td>
                        <select id="listTemp" name="listTemp">
                            <option value="">请选择模版</option>
                        [@stdCode codeType="ARTICLE_LIST_TEMP" all=false]
                            [#list codeMap.entrySet() as entry]
                                <option value="${entry.key}">${entry.value}</option>
                            [/#list]
                        [/@stdCode]
                        </select>
                        <a href="javascript:;" class="arrows">∨</a>
                    </td>

                    <td><label>内容页模版</label></td>
                    <td>
                        <select id="contentTemp" name="contentTemp">
                            <option value="">请选择模版</option>
                        [@stdCode codeType="ARTICLE_CONTENT_TEMP" all=false]
                            [#list codeMap.entrySet() as entry]
                                <option value="${entry.key}">${entry.value}</option>
                            [/#list]
                        [/@stdCode]
                        </select>
                        <a href="javascript:;" class="arrows">∨</a>
                    </td>
                </tr>
                <tr>
                    <td><label>排序<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" maxlength="11" id="orders" name="orders" placeholder="排序(不超过11个字符长度)">
                    </td>

                    <td><label>每页条数<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" id="num" name="num" placeholder="每页显示条数">
                    </td>
                </tr>
                <tr>
                    <td><label>栏目备注</label></td>
                    <td>
                        <textarea maxlength="128" id="remark" name="remark" placeholder="栏目备注(不超过128个字符长度)"></textarea>
                    </td>

                    <td><label>栏目封面</label></td>
                    <td>
                        <input placeholder="封面图(请上传360*200像素的图片)" id="fileName" name="image" type="text" class="uploadTxt"/>
                        <input id="pickfiles" type="button" value="上传" class="uploadBtn"/>
                    </td>
                </tr>
                <tr>
                    <td><label>是否可用<span class="cred"> * </span></label></td>
                    <td>
                        <label><input type="radio" name="isEnabled" class="sex" value="0" checked>否</label>
                        <label><input type="radio" name="isEnabled" class="sex" value="1">是</label>
                    </td>

                [#--<td><label>是否默认<span class="cred"> * </span></label></td>
                <td>
                    <label><input type="radio" name="isDefault" class="sex" value="0" checked>否</label>
                    <label><input type="radio" name="isDefault" class="sex" value="1">是</label>
                </td>--]
                </tr>
            </table>
            <p class="save">
                <input type="submit" value="保存" class="red">
                <input type="button" value="取消" id="backButton" class="red">
            </p>
        </form>
    </div>
</div>
</body>
</html>